package com.study_online.controller;

import com.study_online.domain.Order;
import com.study_online.domain.ResultInfo;
import com.study_online.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 张天霸
 */

@RestController
@Controller
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 添加订单
     * @param order
     * @return
     */
    @RequestMapping("/insert")
    public ResultInfo insert(Order order){
        ResultInfo info = orderService.insert(order);
        return info;
    }

    /**
     * 修改订单为支付状态
     * @param orderNum
     * @param payTime
     * @param alipayNum
     * @return
     */
    @RequestMapping("/updateStatus")
    public ResultInfo updateStatus(String orderNum,String payTime,String alipayNum){
        ResultInfo info = orderService.updateStatus(orderNum,payTime,alipayNum);
        return info;
    }


}